package com.b2bpsssm.controller.material.commodity;

import com.b2bpsssm.common.R;
import com.b2bpsssm.pojo.Commodity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@Api(value = "商品页面",tags = "商品接口Api")
public class CommodityController {


//    @RequestMapping(value = "url路径",method = RequestMethod.GET)
//    @ApiOperation(value = "主标题",notes = "主标题描述",httpMethod = "get/post",response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "page",value = "当前页码",required = true ),
//            @ApiImplicitParam(name = "limit",value = "每页条数",required = true )
//    })


    /*
    * 商品页页码每页条数查询
    * */
    @RequestMapping(value = "/commodity/queryCommodityByPageLimit",method = RequestMethod.GET)
    @ApiOperation(value = "查询商品",notes = "依靠当前页码和每页条数进行查询",httpMethod = "",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "page",value = "当前页码",required = true ),
            @ApiImplicitParam(name = "limit",value = "每页条数",required = true )
    })
    @ResponseBody
    public R queryCommodityByPageLimit(Integer page, Integer limit){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }


    /*
    * 新增商品
    * */
    @RequestMapping(value = "/commodity/addCommodity",method = RequestMethod.POST)
    @ApiOperation(value = "新增商品",notes = "新增并保存",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "com_Id",value = "商品编码",required = true ),
            @ApiImplicitParam(name = "com_Class",value = "商品分类",required = true ),
            @ApiImplicitParam(name = "com_Label_Id",value = "商品标签",required = true ),
            @ApiImplicitParam(name = "com_Bar_Code",value = "条形码",required = true ),
            @ApiImplicitParam(name = "com_Expiration_Date",value = "保质期",required = true ),
            @ApiImplicitParam(name = "com_Unit",value = "库存单位",required = true ),
            @ApiImplicitParam(name = "com_Name",value = "商品名称",required = true ),
            @ApiImplicitParam(name = "com_Putaway_Date",value = "上架日期",required = true ),
            @ApiImplicitParam(name = "com_Status",value = "商品状态（1:上架,2:下架,3:删除）默认1",required = true ),
            @ApiImplicitParam(name = "com_Specification",value = "商品规格",required = true ),
            @ApiImplicitParam(name = "com_Picture",value = "商品图片",required = true ),
            @ApiImplicitParam(name = "com_Create_Date",value = "创建时间（可前端传输，也可后端直接获取系统当前时间）",required = true ),
    })
    @ResponseBody
    public R addCommodity(Commodity commodity){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

    /*
     * 编辑商品
     * */
    @RequestMapping(value = "/commodity/updateCommodity",method = RequestMethod.POST)
    @ApiOperation(value = "修改商品",notes = "保存",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "com_Id",value = "商品编码",required = true ),
            @ApiImplicitParam(name = "com_Class",value = "商品分类",required = true ),
            @ApiImplicitParam(name = "com_Label_Id",value = "商品标签",required = true ),
            @ApiImplicitParam(name = "com_Bar_Code",value = "条形码",required = true ),
            @ApiImplicitParam(name = "com_Expiration_Date",value = "保质期",required = true ),
            @ApiImplicitParam(name = "com_Unit",value = "库存单位",required = true ),
            @ApiImplicitParam(name = "com_Name",value = "商品名称",required = true ),
            @ApiImplicitParam(name = "com_Putaway_Date",value = "上架日期",required = true ),
            @ApiImplicitParam(name = "com_Status",value = "商品状态（1:上架,2:下架,3:删除）默认1",required = true ),
            @ApiImplicitParam(name = "com_Specification",value = "商品规格",required = true ),
            @ApiImplicitParam(name = "com_Picture",value = "商品图片",required = true ),
            @ApiImplicitParam(name = "com_Create_Date",value = "创建时间（可前端传输，也可后端直接获取系统当前时间）",required = true ),
    })
    @ResponseBody
    public R updateCommodity(Commodity commodity){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

    /*
     * 搜索商品
     * */
    @RequestMapping(value = "/commodity/selCommodity",method = RequestMethod.GET)
    @ApiOperation(value = "搜索商品",notes = "三个条件必选其一",httpMethod = "get",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "com_Class",value = "商品分类",required = true ),
            @ApiImplicitParam(name = "com_Create_Date1",value = "创建时间1",required = true ),
            @ApiImplicitParam(name = "com_Create_Date2",value = "创建时间2",required = true ),
            @ApiImplicitParam(name = "com_Name_Key",value = "关键字",required = true )
    })
    @ResponseBody
    public R selCommodity(Commodity commodity){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }


    /*
     * 删除商品
     * */
    @RequestMapping(value = "/commodity/delCommodity",method = RequestMethod.POST)
    @ApiOperation(value = "删除商品",notes = "删除",httpMethod = "post",response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "com_Id",value = "商品编码",required = true )
    })
    @ResponseBody
    public R delCommodity(String comId){
        R r = new R();
        r.setCode(200);
        r.setData(666);
        r.setMassage("success");
        return r;
    }

}
